package com.xxx.ware.ware_manage_sys.bean.vo;

import com.xxx.ware.ware_manage_sys.bean.enums.ResponseEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 响应信息类
 * @author Jxr
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultVo<T> {
    /**
     * 响应状态码
     */
    private Integer code;
    /**
     * 响应结果： 响应成功   响应失败
     */
    private String msg;
    /**
     * 响应详情
     */
    private String message;
    /**
     * 响应信息
     */
    private T data;

    public static <T> ResultVo data(T data){
        return new ResultVo(ResponseEnum.SUCCESS.getCode(), ResponseEnum.SUCCESS.getMsg(),ResponseEnum.SUCCESS.getMsg(), data);
    }

    public static ResultVo fail(String errMsg){
        return new ResultVo(ResponseEnum.FAIL.getCode(), ResponseEnum.FAIL.getMsg(), errMsg, null);
    }

}
